<template>
    <el-row>
        <el-form label-width="120px"
            class="search_prod">
            <el-form-item label="标题查询">
                <el-col :span="5">
                    <el-col :span="24"
                        class="search_input_width">
                        <el-input size="small"
                            clearable
                            v-model="title"
                            placeholder="商品名称"></el-input>
                    </el-col>
                </el-col>
            </el-form-item>
            <!--            <el-form-item label="产品价格">-->
            <!--                <el-col :span="5">-->
            <!--                    <el-col :span="11" style="width:72px">-->
            <!--                        <el-input size="small" clearable v-model="price_max"></el-input>-->
            <!--                    </el-col>-->
            <!--                    <el-col :span="2" class="tc" style="width:26px">-</el-col>-->
            <!--                    <el-col :span="11" style="width:72px">-->
            <!--                        <el-input size="small" clearable v-model="price_min"></el-input>-->
            <!--                    </el-col>-->
            <!--                </el-col>-->
            <!--            </el-form-item>-->
            <el-form-item>
                <el-row class="tl">
                    <el-col :span="24">
                        <el-button :loading='$store.state.isLoading'
                            size="small"
                            type="primary"
                            @click="search_tb(1)">查询</el-button>
                        <el-button :loading='$store.state.isLoading'
                            size="small"
                            type="primary"
                            @click="del_search_tb(1)">一键清除</el-button>
                    </el-col>
                </el-row>
            </el-form-item>
        </el-form>
    </el-row>
</template>

<script>
export default {
  name: "tbsearch",
  data() {
    return {
      title: ""
    };
  },
  methods: {
    del_search_tb(page) {
      this.loading = true;
      var temp = {
        page: page
      };
      this.$api.getShops.getTbCoupon(temp).then(res => {
        this.$emit("listen_search", res.data.result);
        this.loading = false;
      });
    },
    search_tb(page) {
      this.loading = true;
      var temp = {
        title: this.title,
        page: page
      };
      this.$api.getShops.getTbCoupon(temp).then(res => {
        this.$emit("listen_search", res.data.result);
        this.loading = false;
      });
    }
  }
};
</script>

<style scoped>
.tbsearch {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding-left: 5%;
}
.tbsearch_input {
  width: 30%;
  height: 50px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
}
.tbsearch_input p {
  margin-right: 10px;
}
</style>
